class MyIterator:
    def __init__(self, value):
        self.value = value

    def __iter__(self):
        return self

    def __next__(self):
        if self.value > 0:
            self.value -= 1
        else:
            raise StopIteration
        return self.value





iterator = MyIterator(6)
iterator
[x for x in iterator]


print(x for x in iterator)



